package leetcode.code1860;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int[] memLeak(int memory1, int memory2) {
		int p = 1;
		while (true) {
			if (memory1 >= p && memory2 >= p) {
				if (memory1 == memory2 || memory1 > memory2) {
					memory1 -= p;
				} else {
					memory2 -= p;
				}
			} else if (memory1 >= p) {
				memory1 -= p;
			} else if (memory2 >= p) {
				memory2 -= p;

			} else {
				return new int[] { p, memory1, memory2 };
			}
			p++;
		}
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
